<!--
 * @Author: 许警 11378748333@
 * @Date: 2024-06-14 17:12:25
 * @LastEditors: 许警 11378748333@
 * @LastEditTime: 2024-10-17 17:28:40
 * @FilePath: /hsxlsystem/src/App.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div id="nav"></div>
  <a-config-provider :locale="zhCN">
    <router-view v-slot="{ Component }">
      <keep-alive :max="3">
        <component :is="Component" />
      </keep-alive>
      <!-- <component :is="Component" v-if="!$route.meta.keepAlive" /> -->
    </router-view>
  </a-config-provider>
</template>
<script>
import zhCN from 'ant-design-vue/lib/locale/zh_CN'

import 'moment/dist/locale/zh-cn'
import luyouRoute from '@/router/index.js'
import { onActivated, onMounted, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { message } from 'ant-design-vue'
export default {
  setup() {
    const router = useRouter()
    const route = useRoute()

    // 全局配置消息位置、持续时间
    message.config({
      top: `100px`,
      duration: 2,
      maxCount: 3
    })
    onActivated(() => {
      console.log('页面缓存了0000000000000000')
    })

    onMounted(() => {
      window.addEventListener('offline', function () {
        // 网络由异常到正常时触发，跳转到404页面
        router.push({
          path: '/404'
        })
      })
    })
    return {
      zhCN,
      route,
      luyouRoute
    }
  }
}
</script>
<style>
#app {
}
</style>
